﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace intheweel
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string a = textBox1.Text;
            string b = textBox2.Text;
            string c = textBox3.Text;
            if (a == string.Empty || b == string.Empty || c == string.Empty) {
                MessageBox.Show("注册信息不能为空");
            } else if (b==c) {
                string connmit = "server = .; database = Blogs ; uid = sa ; pwd = chen5201314";

                SqlConnection sql = new SqlConnection(connmit);
                sql.Open();
                string xing = string.Format("insert into Users(Username,Password) values ('{0}','{1}')",a,b);
                SqlDataAdapter dataAdapter = new SqlDataAdapter(xing,sql);
                DataTable dataTable = new DataTable();
                dataAdapter.Fill(dataTable);
                MessageBox.Show("注册成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("输入的两次密码不一样");
            }
        }
    }
}
